//
//  QSFetchModel.h
//  QuicklyShop
//
//  Created by 梵天 on 14-7-15.
//  Copyright (c) 2014年 com. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking.h>

#define QSBizErrorDomain @"QSBizErrorDomain"

typedef void (^FetchCompletionHandler) (BOOL isSucceeded, NSError *error);

@interface QSFetchModel : NSObject

//@property (nonatomic, assign) BOOL bizDataIsNull;
@property (nonatomic, assign) BOOL bizResult;
@property (nonatomic, assign) NSNumber *dataCount;  // 用作data直接返回的数字
@property (nonatomic, assign) NSString *dataResut;  // 用作data直接返回的数字

@property (nonatomic, assign) BOOL isNoLoginView;

@property (nonatomic, assign) BOOL enableResetInjectData;
// 请求参数 
@property (nonatomic, strong) NSDictionary *requestParams;

/* 自定义baseUrl, 带端口号 */
@property (nonatomic, strong) NSString *customBaseUrl;

// 自定义的UserAgent信息
+ (NSString *)customUserAgent;

// 请求接口(post方式)
- (void)fetchWithPath:(NSString *)path completionHandler:(FetchCompletionHandler)handler NoProgress:(BOOL)noProgress;

- (void)uploadImageWithPath:(NSString *)path imageData:(NSData *)imgData completionHandler:(FetchCompletionHandler)handler;

// 仅供运行时解析JSON使用，子类不要调用此方法初始化对象
- (instancetype)initWithJSONDict:(NSDictionary *)dict;

// 子类需要覆盖此方法，提供model和JSON无法对应到的成员
- (NSDictionary *)modelKeyJSONKeyMapper;

// Option 子类覆盖此方法，提供不同URL请求地址
- (NSString *)baseURLString;

- (void)uploadFileWithPath:(NSString *)path filePath:(NSString *)filePath completionHandler:(FetchCompletionHandler)handler;

@end